package com.kaizeli.website.pojo.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 项目状态枚举
 */
@Getter
@AllArgsConstructor
public enum ProjectStatusEnum {
    NOT_STARTED("not_started", "未开始"),
    IN_PROGRESS("in_progress", "进行中"),
    PAUSED("paused", "已暂停"),
    CANCELLED("cancelled", "已取消"),
    COMPLETED("completed", "已完成");
    
    private final String code;
    private final String desc;
    
    /**
     * 根据代码获取描述
     */
    public static String getDescByCode(String code) {
        if (code == null) {
            return null;
        }
        for (ProjectStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status.getDesc();
            }
        }
        return null;
    }
    
    /**
     * 根据代码获取枚举
     */
    public static ProjectStatusEnum getByCode(String code) {
        if (code == null) {
            return null;
        }
        for (ProjectStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
}

